﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DataInput
{
    public class TextField : Field
    {
        public TextField() : base ()
        {
        }

        public override bool isValid()
        {
            if (base.isValid())
            {
                if (Value != null && Value is String)
                {
                    if (canBeEmpty)
                        return true;
                    else
                        return value.ToString().Length > 0;
                }
                return false;
            }
            else
                return false;
        }

        public TextField(String fieldName, String fieldLabel, bool canBeEmpty) 
            : this ( fieldName, fieldLabel, canBeEmpty, false )
        {
        }

        public TextField(String fieldName, String fieldLabel, bool canBeEmpty, bool forOutput )
            : base(fieldName, fieldLabel, canBeEmpty, forOutput)
        {
        }

        public TextField(String fieldName, String fieldLabel, Object value, bool canBeEmpty) 
            : this (fieldName, fieldLabel, value, canBeEmpty, false ) 
        {
        }
        public TextField(String fieldName, String fieldLabel, Object value, bool canBeEmpty, bool forOutput )
            : base(fieldName, fieldLabel, value, canBeEmpty, forOutput)
        {
        }
    }
}
